#for循环左下
for row in range(1,10):
    for col in  range(1,row+1):
        print('{}*{}={:<4}'.format(row,col,row*col),end=' ')
    print(' ')
print('')
print('='*60)
#while循环左下
i=1
while i<=9:
    h = 1
    while h<=i:
        print('{}*{}={:<4}'.format(i, h, i * h), end=' ')
        h = h + 1
    i=i+1
    print(' ')
print('='*60)
#for循环左上
for row in range(9,0,-1):
    for col in  range(1,row+1):
        print('{}*{}={:<4}'.format(row,col,row*col),end=' ')
    print(' ')
print('=' * 60)
#while循环左上
i = 9
while i>=1:
    h = 1
    while h<=i:
        print('{}*{}={:<4}'.format(i, h, i * h), end=' ')
        h = h + 1
    i=i-1
    print(' ')
print('='*60)
#for循环右上
for i in range(1, 10):
    for k in range(1, 10-i):
        print('{:7}'.format(''),end="")
    for h in range(1, i+1):
        print('{}*{}={:<2}'.format(i, h, i * h), end=' ')
    print(" ")
print('='*60)
#while循环右下
i=1
while i<=9:
    k = 9-i
    while k>=1:
        print('{:7}'.format(''), end="")
        k=k-1
    h = 1
    while h<=i:
        print('{}*{}={:<2}'.format(i, h, i * h), end=' ')
        h = h + 1
    i=i+1
    print(' ')
print('='*60)
#for循环右上
for i in range(1, 10):
     for k in range(1, i):
        print('{:7}'.format(''),end="")
     for h in range(i, 10):
        print('{}*{}={:<2}'.format(i, h, i * h), end=' ')
     print(" ")
print('='*60)
#for循环右上
i=1
while i<=9:
    k = 1
    while k<i:
        print('{:7}'.format(''), end="")
        k=k+1
    h = i
    while h<10:
        print('{}*{}={:<2}'.format(i, h, i * h), end=' ')
        h = h + 1
    i=i+1
    print(' ')